package com.mzz.behavior.classandclass.command;

/**
 * 命令模式测试类
 *
 * @author xushijian
 * @date 18/5/10 上午9:02
 */
public class CommandDemo {

    public static void main(String[] args) {

        Invoker invoker1 = new Invoker(new MyCommand(new Receiver()));

        invoker1.action();


        //创建士兵对象
        Receiver receiver = new Receiver();

        Command cmd = new MyCommand(receiver);

        //创建司令对象
        Invoker invoker = new Invoker(cmd);

        //发起命令
        invoker.action();

    }
}
